<#assign contextPath = springMacroRequestContext.getContextPath()/>
<#import "/public/frame/main.html" as frame/>
<@frame.head "南航明珠商城-<#if isaudit>审核<#else>查看</#if>商品"></@frame.head>
<style>
	html, body, h1, h2, h3, h4, h5, h6, div, dl, dt, dd, ul, ol, li, p, pre, hr, table, th, td, form, input, button, menu { margin: 0; padding: 0; }
	header, footer, nav{ display: block; }
	li { list-style: none; }
	h1, h2, h3, h4, h5, h6{ font-size: 100%; }
	h1, h2, h3, h4, h5, h6, em, strong, b { font-weight: bold; }
	/*********** 表格TD **********/
	.edit_table td:nth-child(1) {width: 11%;}
	.edit_table td {width: 22%;}
</style>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i>后台管理中心<span class="c-gray en">&gt;</span>商品管理<span class="c-gray en">&gt;</span><#if isaudit>审核<#else>查看</#if>商品 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
  <!-- tab1 start -->
  <p style="font-size: 16px;font-weight: bold;">商品基本信息</h2>	
  <table class="table edit_table">
    <tr>
      <td>商品编号：</td>
      <td colspan="3">
        <input type="text" class="input-text radius" value="${productInfo.id}" disabled="disabled"/>
      </td>
      <td></td>
    </tr>
    <tr>
      <td>商品名称：</td>
      <td colspan="3">
        <input type="text" class="input-text radius" value="${productInfo.baseInfo.name}" disabled="disabled"/>
      </td>
      <td></td>
    </tr>
    <#if productInfo.proType == 4>
      <tr>
        <td>商品子类:</td>
	    <td colspan="4">
	      <div class="radio-box" style="padding-left: 23px; padding-right: 10px;">
	        <input type="radio" value="1" disabled="disabled" name="otherType" id="planeTicket" <#if 4!=productInfo.proType>checked="checked"<#elseif 4==productInfo.proType && 1==productInfo.otherType>checked="checked"</#if>/>
	        <div style="padding-top: 3px;"><label for="planeTicket">机票资质</label></div>
	      </div>
	      <div class="radio-box" style="padding-left: 23px; padding-right: 10px;">
	        <input type="radio" value="2" disabled="disabled" name="otherType" id="cabinLift" <#if 4==productInfo.proType && 2==productInfo.otherType>checked="checked"</#if>/>
	        <div style="padding-top: 3px;"><label for="cabinLift">升舱资质</label></div>
	      </div>
	    </td>
      </tr>
    </#if>
    <#if productInfo.proType == 5>
      <tr>
        <td>开始时间：</td>
	    <td colspan="4">
	      <div class="radio-box" style="padding-left: 23px; padding-right: 51px;">
	        <input type="radio" value="1" disabled="disabled" name="startTimeFlag" id="startTimeFlag1" <#if !productInfo.startTime??>checked="checked"</#if>/>
	        <div style="padding-top: 3px;"><label for="startTimeFlag1">无</label></div>
	      </div>
	      <div class="radio-box" style="padding-left: 23px; padding-right: 5px;">
	        <input type="radio" value="2" disabled="disabled" name="startTimeFlag" id="startTimeFlag2" <#if productInfo.startTime??>checked="checked"</#if>/>
	        <div style="padding-top: 3px;"><label for="startTimeFlag2">待开始</label></div>
	      </div>
	      <div id="startTimeDiv" style="position: relative;padding-left: 20px;padding-top:3px;<#if productInfo.startTime??>display: inline-block;<#else>display: none;</#if>">
	        <label>开始时间&nbsp;</label>
	        <input id="startTime" name="startTime" disabled="disabled" class="input-text disabled radius Wdate" value='${(productInfo.startTime?string("yyyy-MM-dd HH:mm:ss"))!}' onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime\')}',readOnly: true})" style="width: 180px;"/>
	      </div>
	    </td>
      </tr>
      <tr>
        <td>结束时间：</td>
	    <td colspan="4">
	      <div class="radio-box" style="padding-left: 23px; padding-right: 51px;">
	        <input type="radio" value="1" disabled="disabled" name="endTimeFlag" id="endTimeFlag1" <#if !productInfo.endTime??>checked="checked"</#if>/>
	        <div style="padding-top: 3px;"><label for="endTimeFlag1">无</label></div>
	      </div>
	      <div class="radio-box" style="padding-left: 23px; padding-right: 5px;">
	        <input type="radio" value="2" disabled="disabled" name="endTimeFlag" id="endTimeFlag2" <#if productInfo.endTime??>checked="checked"</#if>/>
	        <div style="padding-top: 3px;"><label for="endTimeFlag2">待结束</label></div>
	      </div>
	      <div id="endTimeDiv" style="position: relative;padding-left: 20px;padding-top:3px;<#if productInfo.endTime??>display: inline-block;<#else>display: none;</#if>">
	        <label>结束时间&nbsp;</label>
	        <input id="endTime" name="endTime" disabled="disabled" class="input-text disabled radius Wdate" value='${(productInfo.endTime?string("yyyy-MM-dd HH:mm:ss"))!}' onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime\')}',readOnly: true})" style="width: 180px;"/>
	      </div>
	    </td>
      </tr>
    </#if>
    <#if productInfo.proType != 5>
      <tr>
        <td>商品类别：</td>
        <td>
          <span class="select-box radius"> 
            <select name="typeId" class="select" disabled="disabled">
              <option value="-1">请选择分类</option>
              <#list prodTypeList as prodType> 
	  		  <option value="${prodType.id?c}" <#if prodType.id==productProperty.prodTypeOne.id>selected</#if>>${prodType.name}</option>
	  		</#list>
	  	  </select>   
          </span>
        </td>
        <td>
          <#if prodTypeListTwo?? && prodTypeListTwo?size &gt; 0>
            <span class="select-box radius">
              <select name="typeId" class="select" disabled="disabled">
                <option value="-1">请选择分类</option>
                <#list prodTypeListTwo as prodType> 
                  <option value="${prodType.id?c}" <#if prodType.id==productProperty.prodTypeTwo.id>selected</#if>>${prodType.name}</option>
	            </#list>
	          </select>  
            </span>
          </#if>
        </td>
        <td>
          <#if prodTypeListThree?? && prodTypeListThree?size &gt; 0>
            <span class="select-box radius">
              <select name="typeId" class="select" disabled="disabled">
                <option value="-1">请选择分类</option>
                <#list prodTypeListThree as prodType> 
	  	        <option value="${prodType.id?c}" <#if prodType.id==productProperty.prodTypeThree.id>selected</#if>>${prodType.name}</option>
	  	      </#list>
	  	    </select>  
            </span>
          </#if>
        </td>
        <td>
          <span id="prodTypeSpan4"></span>
          <span id="prodTypeSpan5"></span>
        </td>
      </tr>        
      <tr>
        <td>商品品牌：</td>
        <td>
          <#if brandList?? && brandList?size &gt; 0>
            <span class="select-box radius">
              <select class="select" disabled="disabled">
                <option value="0">请选择品牌</option> 
                <#list brandList as brand> 
                  <option value="${brand.id?c}" <#if brand.id==productInfo.brandId>selected</#if>>${brand.name}</option>
                </#list>
              </select>
            </span>
          </#if>
        </td>
        <td colspan="3"></td>
      </tr>
    </#if>
    <tr>
      <td>商品库存：</td>
      <td>
        <input disabled="disabled" class="input-text radius" type="text" value="${stockNum}"/>
      </td>
      <td colspan="3"></td>
    </tr>
    <#if productInfo.proType != 5>
      <tr>
        <td>警戒库存：</td>
        <td>
          <input disabled="disabled" class="input-text radius" type="text" value="${productInfo.storeInfo.warnStoreNum}"/>
        </td>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td>商品重量：</td>
        <td><input type="text" disabled="disabled" class="input-text radius" value="<#if productInfo.baseInfo.weight??>${productInfo.baseInfo.weight?string.number}</#if>"/></td>
        <td colspan="3">kg</td>
      </tr>
    </#if>
    <tr>
      <td>所属供应商：</td>
      <td>
        <span class="select-box radius">
          <select class="select" disabled="disabled">
            <option value="0">请选择供应商</option> 
            <#list merchantList as merchant> 
              <option value="${merchant.id?c}" <#if merchant.id==productInfo.merchant.id>selected</#if>>${merchant.mercName}</option>
            </#list>
          </select>
        </span>
      </td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <#if productInfo.proType != 5>
      <tr>
         <td>商品关键字：</td>
         <td><input disabled="disabled" class="input-text radius" type="text" name="keywords" value="${keywords[0]}"/></td>
         <td><input disabled="disabled" class="input-text radius" type="text" name="keywords" value="${keywords[1]}"/></td>
         <td><input disabled="disabled" class="input-text radius" type="text" name="keywords" value="${keywords[2]}"/></td>
         <td><input disabled="disabled" class="input-text radius" type="text" name="keywords" value="${keywords[3]}"/></td>
      </tr>
      <tr>
        <td>商品原价：</td> 
        <td>
          <input disabled="disabled" class="input-text radius" type="text" value="${productInfo.priceInfo.payCostMileage}"/>
        </td>
        <td colspan="3">公里 </td> 
      </tr>
    </#if>
    <tr>
      <td>商品价格：</td>
      <td>
        <input disabled="disabled" class="input-text radius" type="text" value="${productInfo.priceInfo.payOneMileage}"/>
      </td>
      <td colspan="3">公里 </td> 
    </tr>
    <tr>
      <td><#if productInfo.proType != 5>商品购买级别：<#else>会员捐赠级别：</#if></td>
      <td>
        <span class="select-box radius">
          <select class="select" disabled="disabled">
            <option value="0">请选择会员等级</option>
            <option <#if productInfo.baseInfo.card==1>selected="selected"</#if> value="1">普通卡会员</option>
            <option <#if productInfo.baseInfo.card==2>selected="selected"</#if> value="2">银卡会员</option>
            <option <#if productInfo.baseInfo.card==3>selected="selected"</#if> value="3">金卡会员</option>
            <option <#if productInfo.baseInfo.card==7>selected="selected"</#if> value="7">白金卡会员</option>
            <option <#if productInfo.baseInfo.card==4>selected="selected"</#if> value="4">无会员等级</option>
          </select>
        </span> 
      </td>
      <td colspan="3">公里 </td> 
    </tr>
    <#if productInfo.proType == 2 || productInfo.proType == 3>
      <tr>
        <td>商品链接：</td>
        <td><input class="input-text radius" type="text" value="${productInfo.merchantUrl}" disabled="disabled"></td>
        <td colspan="3"> </td> 
      </tr>
    </#if>
  </table>
  <!-- tab1 end -->
  <!-- tab2 start -->
  <p style="font-size: 16px;font-weight: bold;">详细图片</p>
  <table class="table">
    <tr>
      <td>
        <div id="show" style="width: 100px; height: 100px;">
	      <img id="image1" src="${contextPath}/resources/images/no_img.jpg" style="width: 100px; height: 100px; border: 1px solid #CCCCCC;"/>
	    </div>
      </td>
	  <td>
	    <div id="show_1" style="width: 100px; height: 100px;">  
	      <img id="image2" src="${contextPath}/resources/images/no_img.jpg" style="width: 100px; height: 100px; border: 1px solid #CCCCCC;"/>
	    </div>
	  </td>
	  <td>
	    <div id="show_2" style="width: 100px; height: 100px;">
	      <img id="image3" src="${contextPath}/resources/images/no_img.jpg" style="width: 100px; height: 100px; border: 1px solid #CCCCCC;"/>
	    </div>
	  </td>
      <td>
        <div id="show_3" style="width: 100px; height: 100px;">
          <img id="image4" src="${contextPath}/resources/images/no_img.jpg" style="width: 100px; height: 100px; border: 1px solid #CCCCCC;"/>
        </div>
      </td>
	  <td>
	    <div id="show_4" style="width: 100px; height: 100px;">
	      <img id="image5" src="${contextPath}/resources/images/no_img.jpg" style="width: 100px; height: 100px; border: 1px solid #CCCCCC;"/>
	    </div>
	  </td>
    </tr>
  </table> 
  <br/>
  <table class="table table-border table-bordered">
    <tr>
      <th width="100px;">颜色</th>
      <th width="155px;">自定义颜色名称</th>
      <th width="230px;">图片（无图片可以不填）</th>
    </tr>
    <tbody id="tColorbody">
      <#if customStyleList?? && (customStyleList?size &gt; 0) >
        <#list customStyleList as custom> 
          <tr id="color${custom.valueId}">
            <td id="colorLable${custom.valueId}">${custom.value}</td>
            <td><input disabled="disabled" class="input-text radius" type="text" id="colorText${custom.valueId}" name="color${custom.valueId}" value="${custom.name}"/></td>
            <td><input disabled="disabled" type="file" name="specsFile"/></td>
          </tr>
        </#list>
      </#if>
    </tbody>
  </table>
  <br/>
  <table class="table table-border table-bordered">
    <tr>
      <th width="100px;">尺寸</th>
      <th width="100px;">颜色</th>
      <th width="150px;">进销存发货编码</th>
      <th width="155px;">库存数</th>
    </tr>
    <tbody id="tSizebody">
      <#if stockList?? && (stockList?size &gt; 0)>
        <#list stockList as stock> 
		  <tr id="${stock.typeId}size${stock.sizeId}">
            <td id="${stock.typeId}size${stock.sizeId}">${stock.sizeName}</td>
            <td>${stock.typeName}</td>
            <td>${stock.skuCode}</td>
            <td><input disabled="disabled" class="input-text radius" type="text" id="size${stock.typeId}_${stock.sizeId}" name="size${stock.typeId}_${stock.sizeId}" value="${stock.num}"/></td>
		  </tr>
        </#list>
      </#if>
    </tbody>
  </table>
  <!-- tab2 end -->
  <!-- tab3 start -->		
  <div>
    <br/>
    <p style="font-size: 16px;font-weight: bold;">商品详情</p>
    <br/>
    ${productInfo.baseInfo.proDetail}
  </div>
  <!-- tab3 end -->
  <#if isaudit>
    <br/>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <#if productInfo.statusInfo.status==1><input class="btn btn-success radius" type="button" value="初审通过" onclick="auditProduct('${productInfo.id?c}','4')"/>
    <#elseif productInfo.statusInfo.status==4><input class="btn btn-success radius" type="button" value="复审通过" onclick="auditProduct('${productInfo.id?c}','5')"/>
    <#elseif productInfo.statusInfo.status==5><input class="btn btn-success radius" type="button" value="终审通过" onclick="auditProduct('${productInfo.id?c}','2')"/>
    </#if>
    &nbsp;<input class="btn btn-danger radius" type="button" value="审核不通过" onclick="auditProduct('${productInfo.id?c}','3')"/>
    <br/>
  </#if> 
</div>
<@frame.end "default"></@frame.end>
<script type="text/javascript">    
var path = "${contextPath}";
$(function() {
	loadProductImage();
	// 初始化单选框样式
	$(".radio-box input").iCheck({
		checkboxClass: "icheckbox-blue",
		radioClass: "iradio-blue",
		increaseArea: "18%"
	});
	// 初始化复选框样式
	$(".check-box input").iCheck({
		checkboxClass: "icheckbox-blue",
		radioClass: "iradio-blue",
		increaseArea: "18%"
	});
});

/**
 * 加载图片
 */
function loadProductImage() {
	<#if imageList?? && imageList?size &gt; 0>
	    <#list imageList as image>
		    <#if image??>
				var img = $("#image${image.sequences + 1}");
				img.attr("src", "${imagePath}/shop/product/${image.prodId}/${image.image}");
		    </#if>
	    </#list>
	</#if>
}

<#if isaudit>
/**
 * 审核商品
 */
function auditProduct(prodId, status) {
	var url = "";
	if (status == "4") {
		url = path + "/product/audit_product_one";
	} else if(status == "5") {
		url = path + "/product/audit_product_two";
	} else if(status == "2") {
		url = path + "/product/audit_product_three";
	} else if(status == "3") {
		url = path + "/product/audit_product_fail";
	}
	if(url != "") {
		$.ajax({
			url: url,
			cache: false,
			type: "post",    
			dataType: "html",
			data: {"prodId": prodId, "status": status},    
			success: function(data) {
				if (data.charAt(0) == "1") {
					layer.msg("您的审核操作成功！", {icon: 1, time: 1000}, function() {
						var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引    
               			parent.search(false);
						parent.layer.close(index);
					});
				} else if(data.charAt(0) == "2") {
					layer.alert("审核失败，请确认当前商品的实际状态！");
				} else {
					layer.alert("您的审核操作失败！");    
				}
			},
			error : function() {}
		}); 
	}
}
</#if>
</script>